﻿/*
Copyright (c) 2011 <a href="http://www.gutgames.com">James Craig</a>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.*/

#region Usings
using System;
using System.Text;
using Gestalt.Attributes;
#endregion

namespace BlammoNet.Config
{
    /// <summary>
    /// Log file configuration object
    /// </summary>
    [ConfigAttribute(Name = "LogFile")]
    public class Config : Gestalt.Config<Config>
    {
        #region Properties

        /// <summary>
        /// Header text displayed in the log
        /// </summary>
        public virtual string Header
        {
            get
            {
                StringBuilder Message = new StringBuilder();
                Message.Append("----------Log-Beginning----------").Append(System.Environment.NewLine);
                Message.Append("Log created using Blammo.Net ver. 1.0").Append(System.Environment.NewLine);
                Message.Append("Blammo.Net created/maintained by James Craig, http://www.gutgames.com").Append(System.Environment.NewLine);
                Message.Append("Date Created: ").Append(DateTime.Now.ToString()).Append(System.Environment.NewLine);
                return Message.ToString();
            }

            set { }
        }

        /// <summary>
        /// Footer text displayed in the log
        /// </summary>
        public virtual string Footer
        {
            get
            {
                return "----------Log-Ending-------------" + System.Environment.NewLine;
            }

            set { }
        }

        /// <summary>
        /// The DateTime format used in logging messages (default is MMMM dd, yyyy HH:mm:ss)
        /// M = month
        /// d = day
        /// y = year
        /// H = hour
        /// m = minute
        /// s = second
        /// </summary>
        public virtual string MessageDateTimeFormat { get { return "MMMM dd, yyyy HH:mm:ss"; } set { } }

        /// <summary>
        /// The DateTime format used in creating files (default is MMddyyHHmmss)
        /// M = month
        /// d = day
        /// y = year
        /// H = hour
        /// m = minute
        /// s = second
        /// </summary>
        public virtual string FileDateTimeFormat { get { return "MMddyyHHmmss"; } set { } }

        /// <summary>
        /// Directory that log files are saved in
        /// </summary>
        public virtual string LogFileLocation { get { return @"C:\logs\"; } set { } }

        /// <summary>
        /// Number of files to rotate through with each logging set
        /// </summary>
        public virtual int NumberOfFiles { get { return 1; } set { } }

        /// <summary>
        /// Interval to switch between files. (0 means no switching)
        /// </summary>
        public virtual int Interval { get { return 0; } set { } }

        /// <summary>
        /// Defines the format for the message
        /// &lt;MessageType&gt; = Message Type
        /// &lt;Message&gt; = Message Text
        /// &lt;Current&gt; = Current Date/Time
        /// </summary>
        public virtual string MessageFormat { get { return "<MessageType> : <Current> : <Message>" + System.Environment.NewLine; } set { } }

        /// <summary>
        /// Defines the format used for the file
        /// &lt;Name&gt; = Log's name
        /// &lt;FileNumber&gt; = File number
        /// &lt;Current&gt; = Current Date/Time
        /// </summary>
        public virtual string FileFormat { get { return "<Name>_<Current>_<FileNumber>.log"; } }

        /// <summary>
        /// Determines if general messages are recorded
        /// </summary>
        public virtual bool GeneralEnabled { get { return true; } }

        /// <summary>
        /// Determines if debug messages are recorded
        /// </summary>
        public virtual bool DebugEnabled { get { return true; } }

        /// <summary>
        /// Determines if trace messages are recorded
        /// </summary>
        public virtual bool TraceEnabled { get { return true; } }

        /// <summary>
        /// Determines if info messages are recorded
        /// </summary>
        public virtual bool InfoEnabled { get { return true; } }

        /// <summary>
        /// Determines if warning messages are recorded
        /// </summary>
        public virtual bool WarnEnabled { get { return true; } }

        /// <summary>
        /// Determines if error messages are recorded
        /// </summary>
        public virtual bool ErrorEnabled { get { return true; } }

        #endregion
    }
}
